package com.lucy.nepu.module.paper.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.lucy.common.converter.JpaColumnConverter;
import com.lucy.common.core.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @author : kindear
 * @Date : 2021-12-24
 * 论文登记成果
 */

/**
 * Q: 论文有没有什么唯一识别代码之类的？
 */
@Getter
@Setter
@ToString
@RequiredArgsConstructor
@Entity
@Table(name = "nepu_paper")
@ApiModel(value = "论文")
public class Paper extends BaseEntity implements Serializable {
    @ApiModelProperty("周期ID")
    @Column(name = "period_id")
    String periodId;

    /**
     * 对应论文词典ID
     */
    @ApiModelProperty(value = "论文/成果词典ID",notes = "")
    @Column(name = "paper_dict_id")
    String paperDictId;

    /** 论文标题 @TIPS 赵春雨 **/
    @ApiModelProperty("论文标题")
    @Column(name = "paper_title")
    String paperTitle;

    /**
     * 第一署名单位
     */
    @ApiModelProperty(value = "第一署名单位")
    @Column(name = "first_signature_unit")
    String firstSignatureUnit;

    /**
     * 论文发表时间
     */
    @ApiModelProperty(value = "论文发表时间")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @Column(name = "publication_time")
    Date publicationTime;

    /**
     * 第一作者
     */
    @ApiModelProperty(value = "第一作者")
    @Column(name = "first_author")
    String firstAuthor;

    /**
     * 第一作者 ID
     */
    @ApiModelProperty(value = "第一作者ID",notes = "缺省值0代表不在教工系统中")
    @Column(name = "first_author_id")
    Long firstAuthorId;

    /**
     * 第二作者
     */
    @ApiModelProperty(value = "第二作者")
    @Column(name = "second_author")
    String secondAuthor;

    /**
     * 第二作者ID
     */
    @ApiModelProperty(value = "第二作者ID",notes = "缺省值0代表不在教工系统中")
    @Column(name = "second_author_id")
    Long secondAuthorId;


    /**
     * 论文总字数
     */
    @NotNull(message = "论文总字数不可为空")
    @ApiModelProperty(value = "论文总字数")
    @Column(name = "total_words")
    Integer totalWords;

    /**
     * 负责人总字数
     */
    @NotNull(message = "负责人总字数不可为空")
    @ApiModelProperty(value = "负责人总字数")
    @Column(name = "leader_total_words")
    Double leaderTotalWords;


    /**
     * 期刊名称
     */
    @ApiModelProperty(value = "期刊名称")
    @NotBlank(message = "期刊名称不可为空")
    @Column(name = "journal_name")
    String journalName;

    /**
     * 刊号
     */
    @ApiModelProperty(value = "刊号")
    @Column(name = "journal_number")
    @NotBlank(message = "刊号不可为空")
    String journalNumber;


    /**
     * 指导教师身份
     */
    @Column(name = "teacher_identity")
    @ApiModelProperty(value = "指导教师身份",notes = "0 无 1 第二作者 2 通讯作者")
    Integer teacherIdentity;

    /**
     * 分配所得工作量
     */
    @ApiModelProperty(value = "工作量",notes = "")
    @Column(name = "workload",scale = 2)
    Double workload;

    /**
     * 关联文件列表
     */
    @Convert(converter = JpaColumnConverter.class)
    @ApiModelProperty(value = "关联文件ID列表")
    @Column(name = "file_ids")
    List<String> fileIds;

    @ApiModelProperty(value = "论文状态",notes = "1保留 0删除")
    @Column(name = "status")
    Integer status;

}
